package com.gitee.wsl.compose.ui.base

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.RichTooltip
import androidx.compose.material3.RichTooltipColors
import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.TooltipScope
import androidx.compose.material3.TooltipState
import androidx.compose.material3.rememberTooltipState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.window.PopupPositionProvider

object Tooltip

@Composable
@OptIn(ExperimentalMaterial3Api::class)
fun Tooltip.state(initialIsVisible: Boolean = false,
                  isPersistent: Boolean = false)
 = rememberTooltipState(initialIsVisible, isPersistent)

@Composable
@ExperimentalMaterial3Api
fun Tooltip.Box(
    positionProvider: PopupPositionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
    tooltip: @Composable TooltipScope.() -> Unit,
    state: TooltipState,
    modifier: Modifier = Modifier,
    focusable: Boolean = true,
    enableUserInput: Boolean = true,
    content: @Composable () -> Unit,
) = TooltipBox(positionProvider, tooltip, state, modifier, focusable, enableUserInput, content)

//
//@Composable
//@ExperimentalMaterial3Api
//fun Tooltip.Rich(
//    modifier: Modifier = Modifier,
//    title: (@Composable () -> Unit)? = null,
//    action: (@Composable () -> Unit)? = null,
//    shape: Shape = TooltipDefaults.richTooltipContainerShape,
//    colors: RichTooltipColors = TooltipDefaults.richTooltipColors(),
//    //tonalElevation: Dp = RichTooltipTokens.ContainerElevation,
//    //shadowElevation: Dp = RichTooltipTokens.ContainerElevation,
//    text: @Composable () -> Unit
//) = RichTooltip(modifier, title, action, shape, colors, text = text)